﻿


using System;
using System.ComponentModel;
using System.Linq;

namespace ModelQLKS.Model
{
    
    
    
    
    /// <summary>
    /// A class which represents the sysdiagrams table in the QLKS Database.
    /// This class is queryable through QLKSDB.sysdiagram 
    /// </summary>

	public partial class sysdiagram: INotifyPropertyChanging, INotifyPropertyChanged
	{
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
	    
	    public sysdiagram(){
	        OnCreated();
	    }
	    
	    #region Properties
	    
        partial void OnnameChanging(string value);
        partial void OnnameChanged();
		
		private string _name;
		public string name { 
		    get{
		        return _name;
		    } 
		    set{
		        this.OnnameChanging(value);
                this.SendPropertyChanging();
                this._name = value;
                this.SendPropertyChanged("name");
                this.OnnameChanged();
		    }
		}
		
        partial void Onprincipal_idChanging(int value);
        partial void Onprincipal_idChanged();
		
		private int _principal_id;
		public int principal_id { 
		    get{
		        return _principal_id;
		    } 
		    set{
		        this.Onprincipal_idChanging(value);
                this.SendPropertyChanging();
                this._principal_id = value;
                this.SendPropertyChanged("principal_id");
                this.Onprincipal_idChanged();
		    }
		}
		
        partial void Ondiagram_idChanging(int value);
        partial void Ondiagram_idChanged();
		
		private int _diagram_id;
		public int diagram_id { 
		    get{
		        return _diagram_id;
		    } 
		    set{
		        this.Ondiagram_idChanging(value);
                this.SendPropertyChanging();
                this._diagram_id = value;
                this.SendPropertyChanged("diagram_id");
                this.Ondiagram_idChanged();
		    }
		}
		
        partial void OnversionChanging(int? value);
        partial void OnversionChanged();
		
		private int? _version;
		public int? version { 
		    get{
		        return _version;
		    } 
		    set{
		        this.OnversionChanging(value);
                this.SendPropertyChanging();
                this._version = value;
                this.SendPropertyChanged("version");
                this.OnversionChanged();
		    }
		}
		
        partial void OndefinitionChanging(byte[] value);
        partial void OndefinitionChanged();
		
		private byte[] _definition;
		public byte[] definition { 
		    get{
		        return _definition;
		    } 
		    set{
		        this.OndefinitionChanging(value);
                this.SendPropertyChanging();
                this._definition = value;
                this.SendPropertyChanged("definition");
                this.OndefinitionChanged();
		    }
		}
		

        #endregion

        #region Foreign Keys
        #endregion


        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
        public event PropertyChangingEventHandler PropertyChanging;
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void SendPropertyChanging()
        {
            var handler = PropertyChanging;
            if (handler != null)
               handler(this, emptyChangingEventArgs);
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyName));
        }

	}
	
    
    
    /// <summary>
    /// A class which represents the NHANVIEN table in the QLKS Database.
    /// This class is queryable through QLKSDB.NHANVIEN 
    /// </summary>

	public partial class NHANVIEN: INotifyPropertyChanging, INotifyPropertyChanged
	{
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
	    
	    public NHANVIEN(){
	        OnCreated();
	    }
	    
	    #region Properties
	    
        partial void OnMSNVChanging(string value);
        partial void OnMSNVChanged();
		
		private string _MSNV;
		public string MSNV { 
		    get{
		        return _MSNV;
		    } 
		    set{
		        this.OnMSNVChanging(value);
                this.SendPropertyChanging();
                this._MSNV = value;
                this.SendPropertyChanged("MSNV");
                this.OnMSNVChanged();
		    }
		}
		
        partial void OnHOTENNVChanging(string value);
        partial void OnHOTENNVChanged();
		
		private string _HOTENNV;
		public string HOTENNV { 
		    get{
		        return _HOTENNV;
		    } 
		    set{
		        this.OnHOTENNVChanging(value);
                this.SendPropertyChanging();
                this._HOTENNV = value;
                this.SendPropertyChanged("HOTENNV");
                this.OnHOTENNVChanged();
		    }
		}
		
        partial void OnMatKhauChanging(string value);
        partial void OnMatKhauChanged();
		
		private string _MatKhau;
		public string MatKhau { 
		    get{
		        return _MatKhau;
		    } 
		    set{
		        this.OnMatKhauChanging(value);
                this.SendPropertyChanging();
                this._MatKhau = value;
                this.SendPropertyChanged("MatKhau");
                this.OnMatKhauChanged();
		    }
		}
		
        partial void OnNGAYSINHNVChanging(DateTime value);
        partial void OnNGAYSINHNVChanged();
		
		private DateTime _NGAYSINHNV;
		public DateTime NGAYSINHNV { 
		    get{
		        return _NGAYSINHNV;
		    } 
		    set{
		        this.OnNGAYSINHNVChanging(value);
                this.SendPropertyChanging();
                this._NGAYSINHNV = value;
                this.SendPropertyChanged("NGAYSINHNV");
                this.OnNGAYSINHNVChanged();
		    }
		}
		
        partial void OnGIOITINHNVChanging(bool value);
        partial void OnGIOITINHNVChanged();
		
		private bool _GIOITINHNV;
		public bool GIOITINHNV { 
		    get{
		        return _GIOITINHNV;
		    } 
		    set{
		        this.OnGIOITINHNVChanging(value);
                this.SendPropertyChanging();
                this._GIOITINHNV = value;
                this.SendPropertyChanged("GIOITINHNV");
                this.OnGIOITINHNVChanged();
		    }
		}
		
        partial void OnDIACHINVChanging(string value);
        partial void OnDIACHINVChanged();
		
		private string _DIACHINV;
		public string DIACHINV { 
		    get{
		        return _DIACHINV;
		    } 
		    set{
		        this.OnDIACHINVChanging(value);
                this.SendPropertyChanging();
                this._DIACHINV = value;
                this.SendPropertyChanged("DIACHINV");
                this.OnDIACHINVChanged();
		    }
		}
		
        partial void OnDIENTHOAINVChanging(string value);
        partial void OnDIENTHOAINVChanged();
		
		private string _DIENTHOAINV;
		public string DIENTHOAINV { 
		    get{
		        return _DIENTHOAINV;
		    } 
		    set{
		        this.OnDIENTHOAINVChanging(value);
                this.SendPropertyChanging();
                this._DIENTHOAINV = value;
                this.SendPropertyChanged("DIENTHOAINV");
                this.OnDIENTHOAINVChanged();
		    }
		}
		
        partial void OnNGAYVAOLAMChanging(DateTime value);
        partial void OnNGAYVAOLAMChanged();
		
		private DateTime _NGAYVAOLAM;
		public DateTime NGAYVAOLAM { 
		    get{
		        return _NGAYVAOLAM;
		    } 
		    set{
		        this.OnNGAYVAOLAMChanging(value);
                this.SendPropertyChanging();
                this._NGAYVAOLAM = value;
                this.SendPropertyChanged("NGAYVAOLAM");
                this.OnNGAYVAOLAMChanged();
		    }
		}
		
        partial void OnHINHChanging(string value);
        partial void OnHINHChanged();
		
		private string _HINH;
		public string HINH { 
		    get{
		        return _HINH;
		    } 
		    set{
		        this.OnHINHChanging(value);
                this.SendPropertyChanging();
                this._HINH = value;
                this.SendPropertyChanged("HINH");
                this.OnHINHChanged();
		    }
		}
		

        #endregion

        #region Foreign Keys
        public IQueryable<HDTHANHTOANPHONG> HDTHANHTOANPHONGS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.HDTHANHTOANPHONGS
                       where items.MSNV == _MSNV
                       select items;
            }
        }

        public IQueryable<THUEPHONG> THUEPHONGS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.THUEPHONGS
                       where items.MSNV == _MSNV
                       select items;
            }
        }

        #endregion


        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
        public event PropertyChangingEventHandler PropertyChanging;
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void SendPropertyChanging()
        {
            var handler = PropertyChanging;
            if (handler != null)
               handler(this, emptyChangingEventArgs);
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyName));
        }

	}
	
    
    
    /// <summary>
    /// A class which represents the KHACHHANG table in the QLKS Database.
    /// This class is queryable through QLKSDB.KHACHHANG 
    /// </summary>

	public partial class KHACHHANG: INotifyPropertyChanging, INotifyPropertyChanged
	{
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
	    
	    public KHACHHANG(){
	        OnCreated();
	    }
	    
	    #region Properties
	    
        partial void OnMSKHChanging(decimal value);
        partial void OnMSKHChanged();
		
		private decimal _MSKH;
		public decimal MSKH { 
		    get{
		        return _MSKH;
		    } 
		    set{
		        this.OnMSKHChanging(value);
                this.SendPropertyChanging();
                this._MSKH = value;
                this.SendPropertyChanged("MSKH");
                this.OnMSKHChanged();
		    }
		}
		
        partial void OnHOTENKHChanging(string value);
        partial void OnHOTENKHChanged();
		
		private string _HOTENKH;
		public string HOTENKH { 
		    get{
		        return _HOTENKH;
		    } 
		    set{
		        this.OnHOTENKHChanging(value);
                this.SendPropertyChanging();
                this._HOTENKH = value;
                this.SendPropertyChanged("HOTENKH");
                this.OnHOTENKHChanged();
		    }
		}
		
        partial void OnGIOITINHKHChanging(bool value);
        partial void OnGIOITINHKHChanged();
		
		private bool _GIOITINHKH;
		public bool GIOITINHKH { 
		    get{
		        return _GIOITINHKH;
		    } 
		    set{
		        this.OnGIOITINHKHChanging(value);
                this.SendPropertyChanging();
                this._GIOITINHKH = value;
                this.SendPropertyChanged("GIOITINHKH");
                this.OnGIOITINHKHChanged();
		    }
		}
		
        partial void OnDIACHIKHChanging(string value);
        partial void OnDIACHIKHChanged();
		
		private string _DIACHIKH;
		public string DIACHIKH { 
		    get{
		        return _DIACHIKH;
		    } 
		    set{
		        this.OnDIACHIKHChanging(value);
                this.SendPropertyChanging();
                this._DIACHIKH = value;
                this.SendPropertyChanged("DIACHIKH");
                this.OnDIACHIKHChanged();
		    }
		}
		
        partial void OnCMNDChanging(string value);
        partial void OnCMNDChanged();
		
		private string _CMND;
		public string CMND { 
		    get{
		        return _CMND;
		    } 
		    set{
		        this.OnCMNDChanging(value);
                this.SendPropertyChanging();
                this._CMND = value;
                this.SendPropertyChanged("CMND");
                this.OnCMNDChanged();
		    }
		}
		
        partial void OnDIENTHOAIKHChanging(string value);
        partial void OnDIENTHOAIKHChanged();
		
		private string _DIENTHOAIKH;
		public string DIENTHOAIKH { 
		    get{
		        return _DIENTHOAIKH;
		    } 
		    set{
		        this.OnDIENTHOAIKHChanging(value);
                this.SendPropertyChanging();
                this._DIENTHOAIKH = value;
                this.SendPropertyChanged("DIENTHOAIKH");
                this.OnDIENTHOAIKHChanged();
		    }
		}
		

        #endregion

        #region Foreign Keys
        public IQueryable<CHITIETTHUEPHONG> CHITIETTHUEPHONGS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.CHITIETTHUEPHONGS
                       where items.MSKH == _MSKH
                       select items;
            }
        }

        #endregion


        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
        public event PropertyChangingEventHandler PropertyChanging;
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void SendPropertyChanging()
        {
            var handler = PropertyChanging;
            if (handler != null)
               handler(this, emptyChangingEventArgs);
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyName));
        }

	}
	
    
    
    /// <summary>
    /// A class which represents the TRANGBITRANGTB table in the QLKS Database.
    /// This class is queryable through QLKSDB.TRANGBITRANGTB 
    /// </summary>

	public partial class TRANGBITRANGTB: INotifyPropertyChanging, INotifyPropertyChanged
	{
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
	    
	    public TRANGBITRANGTB(){
	        OnCreated();
	    }
	    
	    #region Properties
	    
        partial void OnMSLOAIPHONGChanging(string value);
        partial void OnMSLOAIPHONGChanged();
		
		private string _MSLOAIPHONG;
		public string MSLOAIPHONG { 
		    get{
		        return _MSLOAIPHONG;
		    } 
		    set{
		        this.OnMSLOAIPHONGChanging(value);
                this.SendPropertyChanging();
                this._MSLOAIPHONG = value;
                this.SendPropertyChanged("MSLOAIPHONG");
                this.OnMSLOAIPHONGChanged();
		    }
		}
		
        partial void OnMSTBChanging(string value);
        partial void OnMSTBChanged();
		
		private string _MSTB;
		public string MSTB { 
		    get{
		        return _MSTB;
		    } 
		    set{
		        this.OnMSTBChanging(value);
                this.SendPropertyChanging();
                this._MSTB = value;
                this.SendPropertyChanged("MSTB");
                this.OnMSTBChanged();
		    }
		}
		
        partial void OnSOLUONGChanging(int value);
        partial void OnSOLUONGChanged();
		
		private int _SOLUONG;
		public int SOLUONG { 
		    get{
		        return _SOLUONG;
		    } 
		    set{
		        this.OnSOLUONGChanging(value);
                this.SendPropertyChanging();
                this._SOLUONG = value;
                this.SendPropertyChanged("SOLUONG");
                this.OnSOLUONGChanged();
		    }
		}
		

        #endregion

        #region Foreign Keys
        public IQueryable<LOAIPHONG> LOAIPHONGS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.LOAIPHONGS
                       where items.MSLOAIPHONG == _MSLOAIPHONG
                       select items;
            }
        }

        public IQueryable<THIETBI_DV> THIETBI_DVS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.THIETBI_DVS
                       where items.MSTB == _MSTB
                       select items;
            }
        }

        #endregion


        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
        public event PropertyChangingEventHandler PropertyChanging;
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void SendPropertyChanging()
        {
            var handler = PropertyChanging;
            if (handler != null)
               handler(this, emptyChangingEventArgs);
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyName));
        }

	}
	
    
    
    /// <summary>
    /// A class which represents the THUEPHONG table in the QLKS Database.
    /// This class is queryable through QLKSDB.THUEPHONG 
    /// </summary>

	public partial class THUEPHONG: INotifyPropertyChanging, INotifyPropertyChanged
	{
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
	    
	    public THUEPHONG(){
	        OnCreated();
	    }
	    
	    #region Properties
	    
        partial void OnSOHDONGTHUEPHONGChanging(decimal value);
        partial void OnSOHDONGTHUEPHONGChanged();
		
		private decimal _SOHDONGTHUEPHONG;
		public decimal SOHDONGTHUEPHONG { 
		    get{
		        return _SOHDONGTHUEPHONG;
		    } 
		    set{
		        this.OnSOHDONGTHUEPHONGChanging(value);
                this.SendPropertyChanging();
                this._SOHDONGTHUEPHONG = value;
                this.SendPropertyChanged("SOHDONGTHUEPHONG");
                this.OnSOHDONGTHUEPHONGChanged();
		    }
		}
		
        partial void OnMSNVChanging(string value);
        partial void OnMSNVChanged();
		
		private string _MSNV;
		public string MSNV { 
		    get{
		        return _MSNV;
		    } 
		    set{
		        this.OnMSNVChanging(value);
                this.SendPropertyChanging();
                this._MSNV = value;
                this.SendPropertyChanged("MSNV");
                this.OnMSNVChanged();
		    }
		}
		
        partial void OnMSPHONGChanging(string value);
        partial void OnMSPHONGChanged();
		
		private string _MSPHONG;
		public string MSPHONG { 
		    get{
		        return _MSPHONG;
		    } 
		    set{
		        this.OnMSPHONGChanging(value);
                this.SendPropertyChanging();
                this._MSPHONG = value;
                this.SendPropertyChanged("MSPHONG");
                this.OnMSPHONGChanged();
		    }
		}
		
        partial void OnNGAYTHUEChanging(DateTime value);
        partial void OnNGAYTHUEChanged();
		
		private DateTime _NGAYTHUE;
		public DateTime NGAYTHUE { 
		    get{
		        return _NGAYTHUE;
		    } 
		    set{
		        this.OnNGAYTHUEChanging(value);
                this.SendPropertyChanging();
                this._NGAYTHUE = value;
                this.SendPropertyChanged("NGAYTHUE");
                this.OnNGAYTHUEChanged();
		    }
		}
		
        partial void OnNGAYTRADKChanging(DateTime? value);
        partial void OnNGAYTRADKChanged();
		
		private DateTime? _NGAYTRADK;
		public DateTime? NGAYTRADK { 
		    get{
		        return _NGAYTRADK;
		    } 
		    set{
		        this.OnNGAYTRADKChanging(value);
                this.SendPropertyChanging();
                this._NGAYTRADK = value;
                this.SendPropertyChanged("NGAYTRADK");
                this.OnNGAYTRADKChanged();
		    }
		}
		

        #endregion

        #region Foreign Keys
        public IQueryable<CHITIETTHUEPHONG> CHITIETTHUEPHONGS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.CHITIETTHUEPHONGS
                       where items.SOHDONGTHUEPHONG == _SOHDONGTHUEPHONG
                       select items;
            }
        }

        public IQueryable<NHANVIEN> NHANVIENS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.NHANVIENS
                       where items.MSNV == _MSNV
                       select items;
            }
        }

        public IQueryable<DMPHONG> DMPHONGS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.DMPHONGS
                       where items.MSPHONG == _MSPHONG
                       select items;
            }
        }

        public IQueryable<SUDUNGDV> SUDUNGDVS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.SUDUNGDVS
                       where items.SOHDONGTHUEPHONG == _SOHDONGTHUEPHONG
                       select items;
            }
        }

        public IQueryable<HDTHANHTOANPHONG> HDTHANHTOANPHONGS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.HDTHANHTOANPHONGS
                       where items.SOHDONGTHUEPHONG == _SOHDONGTHUEPHONG
                       select items;
            }
        }

        #endregion


        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
        public event PropertyChangingEventHandler PropertyChanging;
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void SendPropertyChanging()
        {
            var handler = PropertyChanging;
            if (handler != null)
               handler(this, emptyChangingEventArgs);
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyName));
        }

	}
	
    
    
    /// <summary>
    /// A class which represents the HDTHANHTOANPHONG table in the QLKS Database.
    /// This class is queryable through QLKSDB.HDTHANHTOANPHONG 
    /// </summary>

	public partial class HDTHANHTOANPHONG: INotifyPropertyChanging, INotifyPropertyChanged
	{
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
	    
	    public HDTHANHTOANPHONG(){
	        OnCreated();
	    }
	    
	    #region Properties
	    
        partial void OnSOTHANHTOANChanging(decimal value);
        partial void OnSOTHANHTOANChanged();
		
		private decimal _SOTHANHTOAN;
		public decimal SOTHANHTOAN { 
		    get{
		        return _SOTHANHTOAN;
		    } 
		    set{
		        this.OnSOTHANHTOANChanging(value);
                this.SendPropertyChanging();
                this._SOTHANHTOAN = value;
                this.SendPropertyChanged("SOTHANHTOAN");
                this.OnSOTHANHTOANChanged();
		    }
		}
		
        partial void OnSOHDONGTHUEPHONGChanging(decimal value);
        partial void OnSOHDONGTHUEPHONGChanged();
		
		private decimal _SOHDONGTHUEPHONG;
		public decimal SOHDONGTHUEPHONG { 
		    get{
		        return _SOHDONGTHUEPHONG;
		    } 
		    set{
		        this.OnSOHDONGTHUEPHONGChanging(value);
                this.SendPropertyChanging();
                this._SOHDONGTHUEPHONG = value;
                this.SendPropertyChanged("SOHDONGTHUEPHONG");
                this.OnSOHDONGTHUEPHONGChanged();
		    }
		}
		
        partial void OnMSNVChanging(string value);
        partial void OnMSNVChanged();
		
		private string _MSNV;
		public string MSNV { 
		    get{
		        return _MSNV;
		    } 
		    set{
		        this.OnMSNVChanging(value);
                this.SendPropertyChanging();
                this._MSNV = value;
                this.SendPropertyChanged("MSNV");
                this.OnMSNVChanged();
		    }
		}
		
        partial void OnNGAYTHANHTOANChanging(DateTime value);
        partial void OnNGAYTHANHTOANChanged();
		
		private DateTime _NGAYTHANHTOAN;
		public DateTime NGAYTHANHTOAN { 
		    get{
		        return _NGAYTHANHTOAN;
		    } 
		    set{
		        this.OnNGAYTHANHTOANChanging(value);
                this.SendPropertyChanging();
                this._NGAYTHANHTOAN = value;
                this.SendPropertyChanged("NGAYTHANHTOAN");
                this.OnNGAYTHANHTOANChanged();
		    }
		}
		
        partial void OnTIENPHONGChanging(decimal? value);
        partial void OnTIENPHONGChanged();
		
		private decimal? _TIENPHONG;
		public decimal? TIENPHONG { 
		    get{
		        return _TIENPHONG;
		    } 
		    set{
		        this.OnTIENPHONGChanging(value);
                this.SendPropertyChanging();
                this._TIENPHONG = value;
                this.SendPropertyChanged("TIENPHONG");
                this.OnTIENPHONGChanged();
		    }
		}
		

        #endregion

        #region Foreign Keys
        public IQueryable<NHANVIEN> NHANVIENS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.NHANVIENS
                       where items.MSNV == _MSNV
                       select items;
            }
        }

        public IQueryable<THUEPHONG> THUEPHONGS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.THUEPHONGS
                       where items.SOHDONGTHUEPHONG == _SOHDONGTHUEPHONG
                       select items;
            }
        }

        #endregion


        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
        public event PropertyChangingEventHandler PropertyChanging;
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void SendPropertyChanging()
        {
            var handler = PropertyChanging;
            if (handler != null)
               handler(this, emptyChangingEventArgs);
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyName));
        }

	}
	
    
    
    /// <summary>
    /// A class which represents the LOAIPHONG table in the QLKS Database.
    /// This class is queryable through QLKSDB.LOAIPHONG 
    /// </summary>

	public partial class LOAIPHONG: INotifyPropertyChanging, INotifyPropertyChanged
	{
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
	    
	    public LOAIPHONG(){
	        OnCreated();
	    }
	    
	    #region Properties
	    
        partial void OnMSLOAIPHONGChanging(string value);
        partial void OnMSLOAIPHONGChanged();
		
		private string _MSLOAIPHONG;
		public string MSLOAIPHONG { 
		    get{
		        return _MSLOAIPHONG;
		    } 
		    set{
		        this.OnMSLOAIPHONGChanging(value);
                this.SendPropertyChanging();
                this._MSLOAIPHONG = value;
                this.SendPropertyChanged("MSLOAIPHONG");
                this.OnMSLOAIPHONGChanged();
		    }
		}
		
        partial void OnTENLOAIPHONGChanging(string value);
        partial void OnTENLOAIPHONGChanged();
		
		private string _TENLOAIPHONG;
		public string TENLOAIPHONG { 
		    get{
		        return _TENLOAIPHONG;
		    } 
		    set{
		        this.OnTENLOAIPHONGChanging(value);
                this.SendPropertyChanging();
                this._TENLOAIPHONG = value;
                this.SendPropertyChanged("TENLOAIPHONG");
                this.OnTENLOAIPHONGChanged();
		    }
		}
		
        partial void OnGIATIENChanging(decimal value);
        partial void OnGIATIENChanged();
		
		private decimal _GIATIEN;
		public decimal GIATIEN { 
		    get{
		        return _GIATIEN;
		    } 
		    set{
		        this.OnGIATIENChanging(value);
                this.SendPropertyChanging();
                this._GIATIEN = value;
                this.SendPropertyChanged("GIATIEN");
                this.OnGIATIENChanged();
		    }
		}
		

        #endregion

        #region Foreign Keys
        public IQueryable<DMPHONG> DMPHONGS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.DMPHONGS
                       where items.MSLOAIPHONG == _MSLOAIPHONG
                       select items;
            }
        }

        public IQueryable<TRANGBITRANGTB> TRANGBITRANGTBS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.TRANGBITRANGTBS
                       where items.MSLOAIPHONG == _MSLOAIPHONG
                       select items;
            }
        }

        #endregion


        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
        public event PropertyChangingEventHandler PropertyChanging;
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void SendPropertyChanging()
        {
            var handler = PropertyChanging;
            if (handler != null)
               handler(this, emptyChangingEventArgs);
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyName));
        }

	}
	
    
    
    /// <summary>
    /// A class which represents the CHITIETTHUEPHONG table in the QLKS Database.
    /// This class is queryable through QLKSDB.CHITIETTHUEPHONG 
    /// </summary>

	public partial class CHITIETTHUEPHONG: INotifyPropertyChanging, INotifyPropertyChanged
	{
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
	    
	    public CHITIETTHUEPHONG(){
	        OnCreated();
	    }
	    
	    #region Properties
	    
        partial void OnSOHDONGTHUEPHONGChanging(decimal value);
        partial void OnSOHDONGTHUEPHONGChanged();
		
		private decimal _SOHDONGTHUEPHONG;
		public decimal SOHDONGTHUEPHONG { 
		    get{
		        return _SOHDONGTHUEPHONG;
		    } 
		    set{
		        this.OnSOHDONGTHUEPHONGChanging(value);
                this.SendPropertyChanging();
                this._SOHDONGTHUEPHONG = value;
                this.SendPropertyChanged("SOHDONGTHUEPHONG");
                this.OnSOHDONGTHUEPHONGChanged();
		    }
		}
		
        partial void OnMSKHChanging(decimal value);
        partial void OnMSKHChanged();
		
		private decimal _MSKH;
		public decimal MSKH { 
		    get{
		        return _MSKH;
		    } 
		    set{
		        this.OnMSKHChanging(value);
                this.SendPropertyChanging();
                this._MSKH = value;
                this.SendPropertyChanged("MSKH");
                this.OnMSKHChanged();
		    }
		}
		
        partial void OnVAITROChanging(string value);
        partial void OnVAITROChanged();
		
		private string _VAITRO;
		public string VAITRO { 
		    get{
		        return _VAITRO;
		    } 
		    set{
		        this.OnVAITROChanging(value);
                this.SendPropertyChanging();
                this._VAITRO = value;
                this.SendPropertyChanged("VAITRO");
                this.OnVAITROChanged();
		    }
		}
		

        #endregion

        #region Foreign Keys
        public IQueryable<THUEPHONG> THUEPHONGS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.THUEPHONGS
                       where items.SOHDONGTHUEPHONG == _SOHDONGTHUEPHONG
                       select items;
            }
        }

        public IQueryable<KHACHHANG> KHACHHANGS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.KHACHHANGS
                       where items.MSKH == _MSKH
                       select items;
            }
        }

        #endregion


        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
        public event PropertyChangingEventHandler PropertyChanging;
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void SendPropertyChanging()
        {
            var handler = PropertyChanging;
            if (handler != null)
               handler(this, emptyChangingEventArgs);
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyName));
        }

	}
	
    
    
    /// <summary>
    /// A class which represents the DMPHONG table in the QLKS Database.
    /// This class is queryable through QLKSDB.DMPHONG 
    /// </summary>

	public partial class DMPHONG: INotifyPropertyChanging, INotifyPropertyChanged
	{
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
	    
	    public DMPHONG(){
	        OnCreated();
	    }
	    
	    #region Properties
	    
        partial void OnMSPHONGChanging(string value);
        partial void OnMSPHONGChanged();
		
		private string _MSPHONG;
		public string MSPHONG { 
		    get{
		        return _MSPHONG;
		    } 
		    set{
		        this.OnMSPHONGChanging(value);
                this.SendPropertyChanging();
                this._MSPHONG = value;
                this.SendPropertyChanged("MSPHONG");
                this.OnMSPHONGChanged();
		    }
		}
		
        partial void OnMSLOAIPHONGChanging(string value);
        partial void OnMSLOAIPHONGChanged();
		
		private string _MSLOAIPHONG;
		public string MSLOAIPHONG { 
		    get{
		        return _MSLOAIPHONG;
		    } 
		    set{
		        this.OnMSLOAIPHONGChanging(value);
                this.SendPropertyChanging();
                this._MSLOAIPHONG = value;
                this.SendPropertyChanged("MSLOAIPHONG");
                this.OnMSLOAIPHONGChanged();
		    }
		}
		
        partial void OnTINHTRANGChanging(string value);
        partial void OnTINHTRANGChanged();
		
		private string _TINHTRANG;
		public string TINHTRANG { 
		    get{
		        return _TINHTRANG;
		    } 
		    set{
		        this.OnTINHTRANGChanging(value);
                this.SendPropertyChanging();
                this._TINHTRANG = value;
                this.SendPropertyChanged("TINHTRANG");
                this.OnTINHTRANGChanged();
		    }
		}
		

        #endregion

        #region Foreign Keys
        public IQueryable<THUEPHONG> THUEPHONGS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.THUEPHONGS
                       where items.MSPHONG == _MSPHONG
                       select items;
            }
        }

        public IQueryable<LOAIPHONG> LOAIPHONGS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.LOAIPHONGS
                       where items.MSLOAIPHONG == _MSLOAIPHONG
                       select items;
            }
        }

        #endregion


        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
        public event PropertyChangingEventHandler PropertyChanging;
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void SendPropertyChanging()
        {
            var handler = PropertyChanging;
            if (handler != null)
               handler(this, emptyChangingEventArgs);
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyName));
        }

	}
	
    
    
    /// <summary>
    /// A class which represents the SUDUNGDV table in the QLKS Database.
    /// This class is queryable through QLKSDB.SUDUNGDV 
    /// </summary>

	public partial class SUDUNGDV: INotifyPropertyChanging, INotifyPropertyChanged
	{
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
	    
	    public SUDUNGDV(){
	        OnCreated();
	    }
	    
	    #region Properties
	    
        partial void OnSOHDONGTHUEPHONGChanging(decimal value);
        partial void OnSOHDONGTHUEPHONGChanged();
		
		private decimal _SOHDONGTHUEPHONG;
		public decimal SOHDONGTHUEPHONG { 
		    get{
		        return _SOHDONGTHUEPHONG;
		    } 
		    set{
		        this.OnSOHDONGTHUEPHONGChanging(value);
                this.SendPropertyChanging();
                this._SOHDONGTHUEPHONG = value;
                this.SendPropertyChanged("SOHDONGTHUEPHONG");
                this.OnSOHDONGTHUEPHONGChanged();
		    }
		}
		
        partial void OnMSTBChanging(string value);
        partial void OnMSTBChanged();
		
		private string _MSTB;
		public string MSTB { 
		    get{
		        return _MSTB;
		    } 
		    set{
		        this.OnMSTBChanging(value);
                this.SendPropertyChanging();
                this._MSTB = value;
                this.SendPropertyChanged("MSTB");
                this.OnMSTBChanged();
		    }
		}
		
        partial void OnNGAYSDChanging(DateTime value);
        partial void OnNGAYSDChanged();
		
		private DateTime _NGAYSD;
		public DateTime NGAYSD { 
		    get{
		        return _NGAYSD;
		    } 
		    set{
		        this.OnNGAYSDChanging(value);
                this.SendPropertyChanging();
                this._NGAYSD = value;
                this.SendPropertyChanged("NGAYSD");
                this.OnNGAYSDChanged();
		    }
		}
		
        partial void OnSOLUONGChanging(int value);
        partial void OnSOLUONGChanged();
		
		private int _SOLUONG;
		public int SOLUONG { 
		    get{
		        return _SOLUONG;
		    } 
		    set{
		        this.OnSOLUONGChanging(value);
                this.SendPropertyChanging();
                this._SOLUONG = value;
                this.SendPropertyChanged("SOLUONG");
                this.OnSOLUONGChanged();
		    }
		}
		

        #endregion

        #region Foreign Keys
        public IQueryable<THIETBI_DV> THIETBI_DVS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.THIETBI_DVS
                       where items.MSTB == _MSTB
                       select items;
            }
        }

        public IQueryable<THUEPHONG> THUEPHONGS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.THUEPHONGS
                       where items.SOHDONGTHUEPHONG == _SOHDONGTHUEPHONG
                       select items;
            }
        }

        #endregion


        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
        public event PropertyChangingEventHandler PropertyChanging;
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void SendPropertyChanging()
        {
            var handler = PropertyChanging;
            if (handler != null)
               handler(this, emptyChangingEventArgs);
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyName));
        }

	}
	
    
    
    /// <summary>
    /// A class which represents the dtproperties table in the QLKS Database.
    /// This class is queryable through QLKSDB.dtproperty 
    /// </summary>

	public partial class dtproperty: INotifyPropertyChanging, INotifyPropertyChanged
	{
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
	    
	    public dtproperty(){
	        OnCreated();
	    }
	    
	    #region Properties
	    
        partial void OnidChanging(int value);
        partial void OnidChanged();
		
		private int _id;
		public int id { 
		    get{
		        return _id;
		    } 
		    set{
		        this.OnidChanging(value);
                this.SendPropertyChanging();
                this._id = value;
                this.SendPropertyChanged("id");
                this.OnidChanged();
		    }
		}
		
        partial void OnobjectidChanging(int? value);
        partial void OnobjectidChanged();
		
		private int? _objectid;
		public int? objectid { 
		    get{
		        return _objectid;
		    } 
		    set{
		        this.OnobjectidChanging(value);
                this.SendPropertyChanging();
                this._objectid = value;
                this.SendPropertyChanged("objectid");
                this.OnobjectidChanged();
		    }
		}
		
        partial void OnpropertyChanging(string value);
        partial void OnpropertyChanged();
		
		private string _property;
		public string property { 
		    get{
		        return _property;
		    } 
		    set{
		        this.OnpropertyChanging(value);
                this.SendPropertyChanging();
                this._property = value;
                this.SendPropertyChanged("property");
                this.OnpropertyChanged();
		    }
		}
		
        partial void OnvalueChanging(string value);
        partial void OnvalueChanged();
		
		private string _value;
		public string value { 
		    get{
		        return _value;
		    } 
		    set{
		        this.OnvalueChanging(value);
                this.SendPropertyChanging();
                this._value = value;
                this.SendPropertyChanged("value");
                this.OnvalueChanged();
		    }
		}
		
        partial void OnuvalueChanging(string value);
        partial void OnuvalueChanged();
		
		private string _uvalue;
		public string uvalue { 
		    get{
		        return _uvalue;
		    } 
		    set{
		        this.OnuvalueChanging(value);
                this.SendPropertyChanging();
                this._uvalue = value;
                this.SendPropertyChanged("uvalue");
                this.OnuvalueChanged();
		    }
		}
		
        partial void OnlvalueChanging(byte[] value);
        partial void OnlvalueChanged();
		
		private byte[] _lvalue;
		public byte[] lvalue { 
		    get{
		        return _lvalue;
		    } 
		    set{
		        this.OnlvalueChanging(value);
                this.SendPropertyChanging();
                this._lvalue = value;
                this.SendPropertyChanged("lvalue");
                this.OnlvalueChanged();
		    }
		}
		
        partial void OnversionChanging(int value);
        partial void OnversionChanged();
		
		private int _version;
		public int version { 
		    get{
		        return _version;
		    } 
		    set{
		        this.OnversionChanging(value);
                this.SendPropertyChanging();
                this._version = value;
                this.SendPropertyChanged("version");
                this.OnversionChanged();
		    }
		}
		

        #endregion

        #region Foreign Keys
        #endregion


        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
        public event PropertyChangingEventHandler PropertyChanging;
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void SendPropertyChanging()
        {
            var handler = PropertyChanging;
            if (handler != null)
               handler(this, emptyChangingEventArgs);
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyName));
        }

	}
	
    
    
    /// <summary>
    /// A class which represents the THIETBI_DV table in the QLKS Database.
    /// This class is queryable through QLKSDB.THIETBI_DV 
    /// </summary>

	public partial class THIETBI_DV: INotifyPropertyChanging, INotifyPropertyChanged
	{
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
	    
	    public THIETBI_DV(){
	        OnCreated();
	    }
	    
	    #region Properties
	    
        partial void OnMSTBChanging(string value);
        partial void OnMSTBChanged();
		
		private string _MSTB;
		public string MSTB { 
		    get{
		        return _MSTB;
		    } 
		    set{
		        this.OnMSTBChanging(value);
                this.SendPropertyChanging();
                this._MSTB = value;
                this.SendPropertyChanged("MSTB");
                this.OnMSTBChanged();
		    }
		}
		
        partial void OnTENTHIETBIChanging(string value);
        partial void OnTENTHIETBIChanged();
		
		private string _TENTHIETBI;
		public string TENTHIETBI { 
		    get{
		        return _TENTHIETBI;
		    } 
		    set{
		        this.OnTENTHIETBIChanging(value);
                this.SendPropertyChanging();
                this._TENTHIETBI = value;
                this.SendPropertyChanged("TENTHIETBI");
                this.OnTENTHIETBIChanged();
		    }
		}
		
        partial void OnDVTChanging(string value);
        partial void OnDVTChanged();
		
		private string _DVT;
		public string DVT { 
		    get{
		        return _DVT;
		    } 
		    set{
		        this.OnDVTChanging(value);
                this.SendPropertyChanging();
                this._DVT = value;
                this.SendPropertyChanged("DVT");
                this.OnDVTChanged();
		    }
		}
		
        partial void OnGIATBChanging(decimal value);
        partial void OnGIATBChanged();
		
		private decimal _GIATB;
		public decimal GIATB { 
		    get{
		        return _GIATB;
		    } 
		    set{
		        this.OnGIATBChanging(value);
                this.SendPropertyChanging();
                this._GIATB = value;
                this.SendPropertyChanged("GIATB");
                this.OnGIATBChanged();
		    }
		}
		
        partial void OnTHIETBICODINHChanging(string value);
        partial void OnTHIETBICODINHChanged();
		
		private string _THIETBICODINH;
		public string THIETBICODINH { 
		    get{
		        return _THIETBICODINH;
		    } 
		    set{
		        this.OnTHIETBICODINHChanging(value);
                this.SendPropertyChanging();
                this._THIETBICODINH = value;
                this.SendPropertyChanged("THIETBICODINH");
                this.OnTHIETBICODINHChanged();
		    }
		}
		

        #endregion

        #region Foreign Keys
        public IQueryable<SUDUNGDV> SUDUNGDVS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.SUDUNGDVS
                       where items.MSTB == _MSTB
                       select items;
            }
        }

        public IQueryable<TRANGBITRANGTB> TRANGBITRANGTBS
        {
            get
            {
                  var db=new ModelQLKS.Model.QLKSDB();
                  return from items in db.TRANGBITRANGTBS
                       where items.MSTB == _MSTB
                       select items;
            }
        }

        #endregion


        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
        public event PropertyChangingEventHandler PropertyChanging;
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void SendPropertyChanging()
        {
            var handler = PropertyChanging;
            if (handler != null)
               handler(this, emptyChangingEventArgs);
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyName));
        }

	}
	
}